package com.example.myapplication6;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.util.Log;

public  class CalcService extends Service {
    private  static final String TAG="TAG";

    private LocalBinder mLocalBinder=new LocalBinder();


    public class LocalBinder extends Binder{//定义了一个MyService类，该类仅有getService方法，通过该方法得到Service实例
        CalcService getService(){
            return CalcService.this;
        }
    }

    public int add(int x,int y){
        return x+y;
    }

    public int subtract(int x,int y){
        return x-y;
    }

    public int multiply(int x,int y){
        return x*y;
    }

    public int divide(int x,int y){
        return x/y;
    }
    @Override
    public IBinder onBind(Intent intent) {
        Log.v(TAG,"Service onBind");
        return mLocalBinder;
    }


}